.class public Lcom/noshufou/android/su/UpdaterFragment;
.super Landroid/support/v4/app/ListFragment;
.source "UpdaterFragment.java"

# interfaces
.implements Landroid/view/View$OnClickListener;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/noshufou/android/su/UpdaterFragment$ConsoleAdapter;,
        Lcom/noshufou/android/su/UpdaterFragment$ConsoleEntry;,
        Lcom/noshufou/android/su/UpdaterFragment$Manifest;,
        Lcom/noshufou/android/su/UpdaterFragment$Step;,
        Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;
    }
.end annotation


# static fields
.field public static final NOTIFICATION_ID:I = 0x2a

.field private static final TAG:Ljava/lang/String; = "Su.UpdaterFragment"


# instance fields
.field private CONSOLE_GREEN:I

.field private CONSOLE_GREY:I

.field private CONSOLE_RED:I

.field private MANIFEST_URL:Ljava/lang/String;

.field private mActionButton:Landroid/widget/Button;

.field private mBusyboxPath:Ljava/lang/String;

.field private mCurrentStep:Lcom/noshufou/android/su/UpdaterFragment$Step;

.field private mManifest:Lcom/noshufou/android/su/UpdaterFragment$Manifest;

.field private mProgressBar:Landroid/widget/ProgressBar;

.field private mStatusText:Landroid/widget/TextView;

.field private mTitleProgress:Landroid/widget/ProgressBar;

.field private mUpdateTask:Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;


# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    .line 45
    invoke-direct {p0}, Landroid/support/v4/app/ListFragment;-><init>()V

    .line 91
    const-string v0, ""

    iput-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->mBusyboxPath:Ljava/lang/String;

    .line 92
    sget-object v0, Lcom/noshufou/android/su/UpdaterFragment$Step;->DOWNLOAD_MANIFEST:Lcom/noshufou/android/su/UpdaterFragment$Step;

    iput-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->mCurrentStep:Lcom/noshufou/android/su/UpdaterFragment$Step;

    .line 45
    return-void
.end method

.method static synthetic access$1(Lcom/noshufou/android/su/UpdaterFragment;)Landroid/widget/ProgressBar;
    .locals 1
    .parameter

    .prologue
    .line 94
    iget-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->mTitleProgress:Landroid/widget/ProgressBar;

    return-object v0
.end method

.method static synthetic access$10(Lcom/noshufou/android/su/UpdaterFragment;)Z
    .locals 1
    .parameter

    .prologue
    .line 815
    invoke-direct {p0}, Lcom/noshufou/android/su/UpdaterFragment;->findBusybox()Z

    move-result v0

    return v0
.end method

.method static synthetic access$11(Lcom/noshufou/android/su/UpdaterFragment;)Ljava/lang/String;
    .locals 1
    .parameter

    .prologue
    .line 91
    iget-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->mBusyboxPath:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$12(Lcom/noshufou/android/su/UpdaterFragment;Ljava/lang/String;Ljava/lang/String;)Z
    .locals 1
    .parameter
    .parameter
    .parameter

    .prologue
    .line 718
    invoke-direct {p0, p1, p2}, Lcom/noshufou/android/su/UpdaterFragment;->verifyFile(Ljava/lang/String;Ljava/lang/String;)Z

    move-result v0

    return v0
.end method

.method static synthetic access$13(Lcom/noshufou/android/su/UpdaterFragment;)Ljava/lang/String;
    .locals 1
    .parameter

    .prologue
    .line 763
    invoke-direct {p0}, Lcom/noshufou/android/su/UpdaterFragment;->whichSu()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method static synthetic access$14(Lcom/noshufou/android/su/UpdaterFragment;Ljava/io/DataOutputStream;Ljava/io/BufferedReader;I[Ljava/lang/String;)Ljava/lang/String;
    .locals 1
    .parameter
    .parameter
    .parameter
    .parameter
    .parameter
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 786
    invoke-direct {p0, p1, p2, p3, p4}, Lcom/noshufou/android/su/UpdaterFragment;->executeCommand(Ljava/io/DataOutputStream;Ljava/io/BufferedReader;I[Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method static synthetic access$15(Lcom/noshufou/android/su/UpdaterFragment;Ljava/io/DataOutputStream;Ljava/io/BufferedReader;[Ljava/lang/String;)Ljava/lang/String;
    .locals 1
    .parameter
    .parameter
    .parameter
    .parameter
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 781
    invoke-direct {p0, p1, p2, p3}, Lcom/noshufou/android/su/UpdaterFragment;->executeCommand(Ljava/io/DataOutputStream;Ljava/io/BufferedReader;[Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method static synthetic access$16(Lcom/noshufou/android/su/UpdaterFragment;)Landroid/widget/ProgressBar;
    .locals 1
    .parameter

    .prologue
    .line 95
    iget-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->mProgressBar:Landroid/widget/ProgressBar;

    return-object v0
.end method

.method static synthetic access$17(Lcom/noshufou/android/su/UpdaterFragment;I)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 702
    invoke-direct {p0, p1}, Lcom/noshufou/android/su/UpdaterFragment;->addConsoleEntry(I)V

    return-void
.end method

.method static synthetic access$18(Lcom/noshufou/android/su/UpdaterFragment;Ljava/lang/String;I)V
    .locals 0
    .parameter
    .parameter
    .parameter

    .prologue
    .line 711
    invoke-direct {p0, p1, p2}, Lcom/noshufou/android/su/UpdaterFragment;->addStatusToEntry(Ljava/lang/String;I)V

    return-void
.end method

.method static synthetic access$19(Lcom/noshufou/android/su/UpdaterFragment;II)V
    .locals 0
    .parameter
    .parameter
    .parameter

    .prologue
    .line 707
    invoke-direct {p0, p1, p2}, Lcom/noshufou/android/su/UpdaterFragment;->addStatusToEntry(II)V

    return-void
.end method

.method static synthetic access$2(Lcom/noshufou/android/su/UpdaterFragment;)Landroid/widget/TextView;
    .locals 1
    .parameter

    .prologue
    .line 96
    iget-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->mStatusText:Landroid/widget/TextView;

    return-object v0
.end method

.method static synthetic access$20(Lcom/noshufou/android/su/UpdaterFragment;Lcom/noshufou/android/su/UpdaterFragment$Manifest;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 90
    iput-object p1, p0, Lcom/noshufou/android/su/UpdaterFragment;->mManifest:Lcom/noshufou/android/su/UpdaterFragment$Manifest;

    return-void
.end method

.method static synthetic access$21(Lcom/noshufou/android/su/UpdaterFragment;Ljava/lang/String;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 91
    iput-object p1, p0, Lcom/noshufou/android/su/UpdaterFragment;->mBusyboxPath:Ljava/lang/String;

    return-void
.end method

.method static synthetic access$22(Lcom/noshufou/android/su/UpdaterFragment;)I
    .locals 1
    .parameter

    .prologue
    .line 51
    iget v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->CONSOLE_GREY:I

    return v0
.end method

.method static synthetic access$3(Lcom/noshufou/android/su/UpdaterFragment;)Landroid/widget/Button;
    .locals 1
    .parameter

    .prologue
    .line 97
    iget-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->mActionButton:Landroid/widget/Button;

    return-object v0
.end method

.method static synthetic access$4(Lcom/noshufou/android/su/UpdaterFragment;)Lcom/noshufou/android/su/UpdaterFragment$Step;
    .locals 1
    .parameter

    .prologue
    .line 92
    iget-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->mCurrentStep:Lcom/noshufou/android/su/UpdaterFragment$Step;

    return-object v0
.end method

.method static synthetic access$5(Lcom/noshufou/android/su/UpdaterFragment;)Ljava/lang/String;
    .locals 1
    .parameter

    .prologue
    .line 50
    iget-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->MANIFEST_URL:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$6(Lcom/noshufou/android/su/UpdaterFragment;)I
    .locals 1
    .parameter

    .prologue
    .line 53
    iget v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->CONSOLE_GREEN:I

    return v0
.end method

.method static synthetic access$7(Lcom/noshufou/android/su/UpdaterFragment;)I
    .locals 1
    .parameter

    .prologue
    .line 52
    iget v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->CONSOLE_RED:I

    return v0
.end method

.method static synthetic access$8(Lcom/noshufou/android/su/UpdaterFragment;)Lcom/noshufou/android/su/UpdaterFragment$Manifest;
    .locals 1
    .parameter

    .prologue
    .line 90
    iget-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->mManifest:Lcom/noshufou/android/su/UpdaterFragment$Manifest;

    return-object v0
.end method

.method static synthetic access$9(Lcom/noshufou/android/su/UpdaterFragment;Lcom/noshufou/android/su/UpdaterFragment$Step;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 92
    iput-object p1, p0, Lcom/noshufou/android/su/UpdaterFragment;->mCurrentStep:Lcom/noshufou/android/su/UpdaterFragment$Step;

    return-void
.end method

.method private addConsoleEntry(I)V
    .locals 2
    .parameter "res"

    .prologue
    .line 703
    new-instance v0, Lcom/noshufou/android/su/UpdaterFragment$ConsoleEntry;

    invoke-direct {v0, p0, p1}, Lcom/noshufou/android/su/UpdaterFragment$ConsoleEntry;-><init>(Lcom/noshufou/android/su/UpdaterFragment;I)V

    .line 704
    .local v0, entry:Lcom/noshufou/android/su/UpdaterFragment$ConsoleEntry;
    invoke-virtual {p0}, Lcom/noshufou/android/su/UpdaterFragment;->getListAdapter()Lcom/noshufou/android/su/UpdaterFragment$ConsoleAdapter;

    move-result-object v1

    invoke-virtual {v1, v0}, Lcom/noshufou/android/su/UpdaterFragment$ConsoleAdapter;->add(Ljava/lang/Object;)V

    .line 705
    return-void
.end method

.method private addStatusToEntry(II)V
    .locals 1
    .parameter "res"
    .parameter "color"

    .prologue
    .line 708
    invoke-virtual {p0}, Lcom/noshufou/android/su/UpdaterFragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v0

    invoke-virtual {v0, p1}, Landroid/support/v4/app/FragmentActivity;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-direct {p0, v0, p2}, Lcom/noshufou/android/su/UpdaterFragment;->addStatusToEntry(Ljava/lang/String;I)V

    .line 709
    return-void
.end method

.method private addStatusToEntry(Ljava/lang/String;I)V
    .locals 3
    .parameter "status"
    .parameter "color"

    .prologue
    .line 712
    invoke-virtual {p0}, Lcom/noshufou/android/su/UpdaterFragment;->getListAdapter()Lcom/noshufou/android/su/UpdaterFragment$ConsoleAdapter;

    move-result-object v1

    invoke-virtual {p0}, Lcom/noshufou/android/su/UpdaterFragment;->getListAdapter()Lcom/noshufou/android/su/UpdaterFragment$ConsoleAdapter;

    move-result-object v2

    invoke-virtual {v2}, Lcom/noshufou/android/su/UpdaterFragment$ConsoleAdapter;->getCount()I

    move-result v2

    add-int/lit8 v2, v2, -0x1

    invoke-virtual {v1, v2}, Lcom/noshufou/android/su/UpdaterFragment$ConsoleAdapter;->getItem(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/noshufou/android/su/UpdaterFragment$ConsoleEntry;

    .line 713
    .local v0, entry:Lcom/noshufou/android/su/UpdaterFragment$ConsoleEntry;
    iput-object p1, v0, Lcom/noshufou/android/su/UpdaterFragment$ConsoleEntry;->status:Ljava/lang/String;

    .line 714
    iput p2, v0, Lcom/noshufou/android/su/UpdaterFragment$ConsoleEntry;->statusColor:I

    .line 715
    return-void
.end method

.method private varargs executeCommand(Ljava/io/DataOutputStream;Ljava/io/BufferedReader;I[Ljava/lang/String;)Ljava/lang/String;
    .locals 9
    .parameter "os"
    .parameter "is"
    .parameter "timeout"
    .parameter "commands"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    const/4 v4, 0x0

    .line 788
    array-length v5, p4

    if-nez v5, :cond_1

    .line 811
    :cond_0
    :goto_0
    return-object v4

    .line 789
    :cond_1
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    .line 790
    .local v0, command:Ljava/lang/StringBuilder;
    array-length v6, p4

    const/4 v5, 0x0

    :goto_1
    if-lt v5, v6, :cond_3

    .line 793
    const-string v5, "\n"

    invoke-virtual {v0, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 794
    const-string v5, "Su.UpdaterFragment"

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 795
    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {p1, v5}, Ljava/io/DataOutputStream;->writeBytes(Ljava/lang/String;)V

    .line 796
    if-eqz p2, :cond_0

    .line 797
    const/4 v2, 0x0

    .local v2, i:I
    :goto_2
    if-lt v2, p3, :cond_4

    .line 805
    :cond_2
    invoke-virtual {p2}, Ljava/io/BufferedReader;->ready()Z

    move-result v5

    if-eqz v5, :cond_0

    .line 806
    invoke-virtual {p2}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v4

    goto :goto_0

    .line 790
    .end local v2           #i:I
    :cond_3
    aget-object v3, p4, v5

    .line 791
    .local v3, s:Ljava/lang/String;
    invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    const-string v8, " "

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 790
    add-int/lit8 v5, v5, 0x1

    goto :goto_1

    .line 798
    .end local v3           #s:Ljava/lang/String;
    .restart local v2       #i:I
    :cond_4
    invoke-virtual {p2}, Ljava/io/BufferedReader;->ready()Z

    move-result v5

    if-nez v5, :cond_2

    .line 800
    const-wide/16 v5, 0x5

    :try_start_0
    invoke-static {v5, v6}, Ljava/lang/Thread;->sleep(J)V
    :try_end_0
    .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0

    .line 797
    :goto_3
    add-int/lit8 v2, v2, 0x1

    goto :goto_2

    .line 801
    :catch_0
    move-exception v1

    .line 802
    .local v1, e:Ljava/lang/InterruptedException;
    const-string v5, "Su.UpdaterFragment"

    const-string v6, "Sleep timer interrupted"

    invoke-static {v5, v6, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_3
.end method

.method private varargs executeCommand(Ljava/io/DataOutputStream;Ljava/io/BufferedReader;[Ljava/lang/String;)Ljava/lang/String;
    .locals 1
    .parameter "os"
    .parameter "is"
    .parameter "commands"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 783
    const/16 v0, 0xc8

    invoke-direct {p0, p1, p2, v0, p3}, Lcom/noshufou/android/su/UpdaterFragment;->executeCommand(Ljava/io/DataOutputStream;Ljava/io/BufferedReader;I[Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method private findBusybox()Z
    .locals 8

    .prologue
    const/4 v3, 0x0

    .line 816
    const-string v4, "PATH"

    invoke-static {v4}, Ljava/lang/System;->getenv(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    .line 817
    .local v1, path:Ljava/lang/String;
    const-string v4, ":"

    invoke-virtual {v1, v4}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v5

    array-length v6, v5

    move v4, v3

    :goto_0
    if-lt v4, v6, :cond_0

    .line 824
    :goto_1
    return v3

    .line 817
    :cond_0
    aget-object v2, v5, v4

    .line 818
    .local v2, s:Ljava/lang/String;
    new-instance v0, Ljava/io/File;

    const-string v7, "busybox"

    invoke-direct {v0, v2, v7}, Ljava/io/File;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    .line 819
    .local v0, file:Ljava/io/File;
    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v7

    if-eqz v7, :cond_1

    .line 820
    invoke-virtual {v0}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v3

    iput-object v3, p0, Lcom/noshufou/android/su/UpdaterFragment;->mBusyboxPath:Ljava/lang/String;

    .line 821
    const/4 v3, 0x1

    goto :goto_1

    .line 817
    :cond_1
    add-int/lit8 v4, v4, 0x1

    goto :goto_0
.end method

.method private verifyFile(Ljava/lang/String;Ljava/lang/String;)Z
    .locals 12
    .parameter "path"
    .parameter "md5sum"

    .prologue
    const/4 v7, 0x1

    const/4 v6, 0x0

    .line 719
    iget-object v8, p0, Lcom/noshufou/android/su/UpdaterFragment;->mBusyboxPath:Ljava/lang/String;

    if-nez v8, :cond_0

    .line 720
    const-string v7, "Su.UpdaterFragment"

    const-string v8, "Busybox not present"

    invoke-static {v7, v8}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 760
    :goto_0
    return v6

    .line 724
    :cond_0
    const/4 v5, 0x0

    .line 726
    .local v5, process:Ljava/lang/Process;
    :try_start_0
    invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

    move-result-object v8

    .line 727
    const/4 v9, 0x3

    new-array v9, v9, [Ljava/lang/String;

    const/4 v10, 0x0

    iget-object v11, p0, Lcom/noshufou/android/su/UpdaterFragment;->mBusyboxPath:Ljava/lang/String;

    aput-object v11, v9, v10

    const/4 v10, 0x1

    const-string v11, "md5sum"

    aput-object v11, v9, v10

    const/4 v10, 0x2

    aput-object p1, v9, v10

    .line 726
    invoke-virtual {v8, v9}, Ljava/lang/Runtime;->exec([Ljava/lang/String;)Ljava/lang/Process;

    move-result-object v5

    .line 728
    new-instance v4, Ljava/io/BufferedReader;

    new-instance v8, Ljava/io/InputStreamReader;

    .line 729
    new-instance v9, Ljava/io/DataInputStream;

    invoke-virtual {v5}, Ljava/lang/Process;->getInputStream()Ljava/io/InputStream;

    move-result-object v10

    invoke-direct {v9, v10}, Ljava/io/DataInputStream;-><init>(Ljava/io/InputStream;)V

    invoke-direct {v8, v9}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V

    const/16 v9, 0x40

    .line 728
    invoke-direct {v4, v8, v9}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;I)V

    .line 730
    .local v4, is:Ljava/io/BufferedReader;
    new-instance v1, Ljava/io/BufferedReader;

    new-instance v8, Ljava/io/InputStreamReader;

    .line 731
    new-instance v9, Ljava/io/DataInputStream;

    invoke-virtual {v5}, Ljava/lang/Process;->getErrorStream()Ljava/io/InputStream;

    move-result-object v10

    invoke-direct {v9, v10}, Ljava/io/DataInputStream;-><init>(Ljava/io/InputStream;)V

    invoke-direct {v8, v9}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V

    const/16 v9, 0x40

    .line 730
    invoke-direct {v1, v8, v9}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;I)V

    .line 732
    .local v1, es:Ljava/io/BufferedReader;
    const/4 v2, 0x0

    .local v2, i:I
    :goto_1
    const/16 v8, 0xc8

    if-lt v2, v8, :cond_3

    .line 740
    :cond_1
    const/4 v3, 0x0

    .line 741
    .local v3, inLine:Ljava/lang/String;
    invoke-virtual {v1}, Ljava/io/BufferedReader;->ready()Z

    move-result v8

    if-eqz v8, :cond_2

    .line 742
    invoke-virtual {v1}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v3

    .line 743
    const-string v8, "Su.UpdaterFragment"

    invoke-static {v8, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 745
    :cond_2
    invoke-virtual {v4}, Ljava/io/BufferedReader;->ready()Z

    move-result v8

    if-eqz v8, :cond_4

    .line 746
    invoke-virtual {v4}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v3

    .line 751
    invoke-virtual {v5}, Ljava/lang/Process;->destroy()V

    .line 752
    const-string v8, " "

    invoke-virtual {v3, v8}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v8

    const/4 v9, 0x0

    aget-object v8, v8, v9

    invoke-virtual {v8, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v8

    if-nez v8, :cond_5

    .line 753
    const-string v7, "Su.UpdaterFragment"

    const-string v8, "Checksum mismatch"

    invoke-static {v7, v8}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 756
    .end local v1           #es:Ljava/io/BufferedReader;
    .end local v2           #i:I
    .end local v3           #inLine:Ljava/lang/String;
    .end local v4           #is:Ljava/io/BufferedReader;
    :catch_0
    move-exception v0

    .line 757
    .local v0, e:Ljava/io/IOException;
    const-string v7, "Su.UpdaterFragment"

    const-string v8, "Checking of md5sum failed"

    invoke-static {v7, v8, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto/16 :goto_0

    .line 733
    .end local v0           #e:Ljava/io/IOException;
    .restart local v1       #es:Ljava/io/BufferedReader;
    .restart local v2       #i:I
    .restart local v4       #is:Ljava/io/BufferedReader;
    :cond_3
    :try_start_1
    invoke-virtual {v4}, Ljava/io/BufferedReader;->ready()Z
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0

    move-result v8

    if-nez v8, :cond_1

    .line 735
    const-wide/16 v8, 0x5

    :try_start_2
    invoke-static {v8, v9}, Ljava/lang/Thread;->sleep(J)V
    :try_end_2
    .catch Ljava/lang/InterruptedException; {:try_start_2 .. :try_end_2} :catch_1
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0

    .line 732
    :goto_2
    add-int/lit8 v2, v2, 0x1

    goto :goto_1

    .line 736
    :catch_1
    move-exception v0

    .line 737
    .local v0, e:Ljava/lang/InterruptedException;
    :try_start_3
    const-string v8, "Su.UpdaterFragment"

    const-string v9, "Sleep timer got interrupted..."

    invoke-static {v8, v9}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_2

    .line 748
    .end local v0           #e:Ljava/lang/InterruptedException;
    .restart local v3       #inLine:Ljava/lang/String;
    :cond_4
    const-string v7, "Su.UpdaterFragment"

    const-string v8, "Could not check md5sum"

    invoke-static {v7, v8}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_3
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_0

    goto/16 :goto_0

    :cond_5
    move v6, v7

    .line 760
    goto/16 :goto_0
.end method

.method private whichSu()Ljava/lang/String;
    .locals 9

    .prologue
    .line 764
    const-string v3, "PATH"

    invoke-static {v3}, Ljava/lang/System;->getenv(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    const-string v4, ":"

    invoke-virtual {v3, v4}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v4

    array-length v5, v4

    const/4 v3, 0x0

    :goto_0
    if-lt v3, v5, :cond_0

    .line 778
    const/4 v3, 0x0

    :goto_1
    return-object v3

    .line 764
    :cond_0
    aget-object v1, v4, v3

    .line 765
    .local v1, s:Ljava/lang/String;
    new-instance v2, Ljava/io/File;

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v7

    invoke-direct {v6, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v7, "/su"

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-direct {v2, v6}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 766
    .local v2, su:Ljava/io/File;
    invoke-virtual {v2}, Ljava/io/File;->exists()Z

    move-result v6

    if-eqz v6, :cond_1

    invoke-virtual {v2}, Ljava/io/File;->isFile()Z

    move-result v6

    if-eqz v6, :cond_1

    .line 768
    :try_start_0
    invoke-virtual {v2}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v2}, Ljava/io/File;->getCanonicalPath()Ljava/lang/String;

    move-result-object v7

    invoke-virtual {v6, v7}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-eqz v6, :cond_1

    .line 769
    invoke-virtual {v2}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v3

    goto :goto_1

    .line 771
    :catch_0
    move-exception v0

    .line 774
    .local v0, e:Ljava/io/IOException;
    const-string v6, "Su.UpdaterFragment"

    new-instance v7, Ljava/lang/StringBuilder;

    const-string v8, "IOException while finding canonical path of "

    invoke-direct {v7, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v6, v7, v0}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    .line 764
    .end local v0           #e:Ljava/io/IOException;
    :cond_1
    add-int/lit8 v3, v3, 0x1

    goto :goto_0
.end method


# virtual methods
.method public bridge synthetic getListAdapter()Landroid/widget/ListAdapter;
    .locals 1

    .prologue
    .line 1
    invoke-virtual {p0}, Lcom/noshufou/android/su/UpdaterFragment;->getListAdapter()Lcom/noshufou/android/su/UpdaterFragment$ConsoleAdapter;

    move-result-object v0

    return-object v0
.end method

.method public getListAdapter()Lcom/noshufou/android/su/UpdaterFragment$ConsoleAdapter;
    .locals 1

    .prologue
    .line 147
    invoke-super {p0}, Landroid/support/v4/app/ListFragment;->getListAdapter()Landroid/widget/ListAdapter;

    move-result-object v0

    check-cast v0, Lcom/noshufou/android/su/UpdaterFragment$ConsoleAdapter;

    return-object v0
.end method

.method public onActivityCreated(Landroid/os/Bundle;)V
    .locals 3
    .parameter "savedInstanceState"

    .prologue
    .line 124
    invoke-super {p0, p1}, Landroid/support/v4/app/ListFragment;->onActivityCreated(Landroid/os/Bundle;)V

    .line 125
    new-instance v0, Lcom/noshufou/android/su/UpdaterFragment$ConsoleAdapter;

    invoke-virtual {p0}, Lcom/noshufou/android/su/UpdaterFragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v1

    invoke-direct {v0, p0, v1}, Lcom/noshufou/android/su/UpdaterFragment$ConsoleAdapter;-><init>(Lcom/noshufou/android/su/UpdaterFragment;Landroid/content/Context;)V

    invoke-virtual {p0, v0}, Lcom/noshufou/android/su/UpdaterFragment;->setListAdapter(Landroid/widget/ListAdapter;)V

    .line 126
    iget-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->mProgressBar:Landroid/widget/ProgressBar;

    invoke-virtual {p0}, Lcom/noshufou/android/su/UpdaterFragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v1

    const v2, 0x10a0004

    invoke-virtual {v0, v1, v2}, Landroid/widget/ProgressBar;->setInterpolator(Landroid/content/Context;I)V

    .line 127
    new-instance v0, Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;

    const/4 v1, 0x0

    invoke-direct {v0, p0, v1}, Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;-><init>(Lcom/noshufou/android/su/UpdaterFragment;Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;)V

    iput-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->mUpdateTask:Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;

    .line 128
    iget-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->mUpdateTask:Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;

    const/4 v1, 0x0

    new-array v1, v1, [Ljava/lang/Void;

    invoke-virtual {v0, v1}, Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    .line 129
    return-void
.end method

.method public onClick(Landroid/view/View;)V
    .locals 2
    .parameter "view"

    .prologue
    .line 141
    new-instance v0, Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;

    const/4 v1, 0x0

    invoke-direct {v0, p0, v1}, Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;-><init>(Lcom/noshufou/android/su/UpdaterFragment;Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;)V

    iput-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->mUpdateTask:Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;

    .line 142
    iget-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->mUpdateTask:Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;

    const/4 v1, 0x0

    new-array v1, v1, [Ljava/lang/Void;

    invoke-virtual {v0, v1}, Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    .line 143
    return-void
.end method

.method public onCreateView(Landroid/view/LayoutInflater;Landroid/view/ViewGroup;Landroid/os/Bundle;)Landroid/view/View;
    .locals 3
    .parameter "inflater"
    .parameter "container"
    .parameter "savedInstanceState"

    .prologue
    .line 104
    sget-object v1, Landroid/os/Build$VERSION;->SDK:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v1

    const/4 v2, 0x5

    if-ge v1, v2, :cond_0

    .line 105
    const v1, 0x7f0b008f

    .line 104
    :goto_0
    invoke-virtual {p0, v1}, Lcom/noshufou/android/su/UpdaterFragment;->getString(I)Ljava/lang/String;

    move-result-object v1

    iput-object v1, p0, Lcom/noshufou/android/su/UpdaterFragment;->MANIFEST_URL:Ljava/lang/String;

    .line 106
    invoke-virtual {p0}, Lcom/noshufou/android/su/UpdaterFragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v1

    invoke-virtual {v1}, Landroid/support/v4/app/FragmentActivity;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    const v2, 0x7f080006

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getColor(I)I

    move-result v1

    iput v1, p0, Lcom/noshufou/android/su/UpdaterFragment;->CONSOLE_GREY:I

    .line 107
    invoke-virtual {p0}, Lcom/noshufou/android/su/UpdaterFragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v1

    invoke-virtual {v1}, Landroid/support/v4/app/FragmentActivity;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    const v2, 0x7f080007

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getColor(I)I

    move-result v1

    iput v1, p0, Lcom/noshufou/android/su/UpdaterFragment;->CONSOLE_RED:I

    .line 108
    invoke-virtual {p0}, Lcom/noshufou/android/su/UpdaterFragment;->getActivity()Landroid/support/v4/app/FragmentActivity;

    move-result-object v1

    invoke-virtual {v1}, Landroid/support/v4/app/FragmentActivity;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    const v2, 0x7f080008

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->getColor(I)I

    move-result v1

    iput v1, p0, Lcom/noshufou/android/su/UpdaterFragment;->CONSOLE_GREEN:I

    .line 110
    const v1, 0x7f03000d

    const/4 v2, 0x0

    invoke-virtual {p1, v1, p2, v2}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object v0

    .line 112
    .local v0, view:Landroid/view/View;
    const v1, 0x7f0a0002

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/TextView;

    const v2, 0x7f0b0088

    invoke-virtual {v1, v2}, Landroid/widget/TextView;->setText(I)V

    .line 113
    const v1, 0x7f0a0010

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/ProgressBar;

    iput-object v1, p0, Lcom/noshufou/android/su/UpdaterFragment;->mTitleProgress:Landroid/widget/ProgressBar;

    .line 114
    const v1, 0x7f0a0035

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/ProgressBar;

    iput-object v1, p0, Lcom/noshufou/android/su/UpdaterFragment;->mProgressBar:Landroid/widget/ProgressBar;

    .line 115
    const v1, 0x7f0a0028

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/TextView;

    iput-object v1, p0, Lcom/noshufou/android/su/UpdaterFragment;->mStatusText:Landroid/widget/TextView;

    .line 116
    const v1, 0x7f0a0036

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/Button;

    iput-object v1, p0, Lcom/noshufou/android/su/UpdaterFragment;->mActionButton:Landroid/widget/Button;

    .line 117
    iget-object v1, p0, Lcom/noshufou/android/su/UpdaterFragment;->mActionButton:Landroid/widget/Button;

    invoke-virtual {v1, p0}, Landroid/widget/Button;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 119
    return-object v0

    .line 105
    .end local v0           #view:Landroid/view/View;
    :cond_0
    const v1, 0x7f0b0090

    goto/16 :goto_0
.end method

.method public onStop()V
    .locals 2

    .prologue
    .line 133
    invoke-super {p0}, Landroid/support/v4/app/ListFragment;->onStop()V

    .line 134
    iget-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->mUpdateTask:Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;

    if-eqz v0, :cond_0

    .line 135
    iget-object v0, p0, Lcom/noshufou/android/su/UpdaterFragment;->mUpdateTask:Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Lcom/noshufou/android/su/UpdaterFragment$UpdateTask;->cancel(Z)Z

    .line 137
    :cond_0
    return-void
.end method
